//
//  GoodsCreditsCell.m
//  TerritoryShopkeeper
//
//  Created by xiaowu on 2018/1/2.
//  Copyright © 2018年 ZDQK. All rights reserved.
//

#import "GoodsCreditsCell.h"

@implementation GoodsCreditsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.titleLabel.textColor = [UIColor redF2color];
    
    self.saleCountLabel.font = TextPingFangFontSize(12);
    self.saleCountLabel.textColor = [UIColor blackColor];
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setValueForCell:(NSString *)credits count:(NSString *)count {
    
    credits = TextIsNotNil(credits)?credits:@"0";
    count = TextIsNotNil(count)?count:@"0";
    
    NSString *priceStr = [NSString stringWithFormat:@"积分：%@",credits];
    NSMutableAttributedString *priceAttStr = [[NSMutableAttributedString alloc] initWithString:priceStr];
    [priceAttStr setAttributes:@{NSFontAttributeName:TextPingFangFontSize(14)} range:NSMakeRange(0, priceStr.length)];
    [priceAttStr setAttributes:@{NSFontAttributeName:TextPingFangMediumFontSize(20)} range:[priceStr rangeOfString:credits]];
    [self.titleLabel setAttributedText:priceAttStr];
    
    self.saleCountLabel.text = [NSString stringWithFormat:@"销量%@笔", count];
}

@end
